/*
 * HttpDownloader.h
 *
 *  Created on: 2017年7月26日
 *      Author: terry
 */

#ifndef HTTPDOWNLOADER_H_
#define HTTPDOWNLOADER_H_

#include "HttpClient.h"

class HttpDownloader 
{
public:
	class Sink
	{
	public:
		virtual ~Sink() {}

		virtual void onDownload(const std::string& url, const std::string& filepath, int code) = 0;
	};

public:
	virtual ~HttpDownloader() {}

	virtual bool download(const std::string& url, const std::string& filepath, const StringMap& headers, Sink* sink) = 0;

	virtual void close() = 0;

};

#endif /* HTTPDOWNLOADER_H_ */
